package com.jeff.penny.descriptor;

import java.io.Reader;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;

public class WebAppFactory
{
  private final JAXBContext context;

  public WebAppFactory() throws JAXBException
  {
    context = JAXBContext.newInstance(WebAppDefinition.class);
  }

  public WebAppDefinition buildDefinition(Reader reader) throws JAXBException
  {
    Unmarshaller unmarshaller = context.createUnmarshaller();
    return (WebAppDefinition) unmarshaller.unmarshal(reader);
  }
}
